﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WF_ExportTool.Configuration.Grid;

namespace WF_ExportTool.Configuration.Form
{
    /// <summary>
    /// 表单主表
    /// </summary>
    public class Form_Main : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 表单编码
        /// </summary>
        public string FormCode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int AutoIndex { get; set; }
        /// <summary>
        /// 表单标题
        /// </summary>
        public string FormTitle { get; set; }
        /// <summary>
        /// 所属子系统
        /// </summary>
        public int SysId { get; set; }
        /// <summary>
        /// 所属业务功能
        /// </summary>
        public string FuncTitle { get; set; }
        /// <summary>
        /// 数据库实例名
        /// </summary>
        public string DbIns { get; set; }
        /// <summary>
        /// 数据库库名
        /// </summary>
        public string DbName { get; set; }
        /// <summary>
        /// 主表表名
        /// </summary>
        public string MainTableName { get; set; }
        /// <summary>
        /// 主键字段名
        /// </summary>
        public string PKFieldName { get; set; }
        /// <summary>
        /// 主键值类型
        /// </summary>
        public int PKValueType { get; set; }
    }
    /// <summary>
    /// 表单子表
    /// </summary>
    public class Form_ChildTable : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int RelateId { get; set; }
        /// <summary>
        /// 表单编码
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 子表表名
        /// </summary>
        public string TableName { get; set; }
        /// <summary>
        /// 子表主键名
        /// </summary>
        public string PKFieldName { get; set; }
        /// <summary>
        /// 子表主健值类型
        /// </summary>
        public int PKValueType { get; set; }
        /// <summary>
        /// 关联字段名
        /// </summary>
        public string RelateFieldName { get; set; }
        /// <summary>
        /// 关联类型
        /// </summary>
        public int RelateType { get; set; }
        /// <summary>
        /// 是否级联删除
        /// </summary>
        public Boolean RelateDel { get; set; }
        /// <summary>
        /// 以下字段值为空时，则不保存这条子表数据，多个用,分隔
        /// </summary>
        public string FieldNullNotSaveData { get; set; }
    }
    /// <summary>
    /// 表单字段信息
    /// </summary>
    public class Form_Field : BaseEntity
    {
        /// <summary>
        /// 字段主键
        /// </summary>
        public int FieldId { get; set; }
        /// <summary>
        /// 表单主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Boolean IsChildTable { get; set; }
        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }
        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName { get; set; }
        /// <summary>
        /// 存储值的字段名，一般如下拉 列表，组织机构选择控件，附件上传等会用到
        /// </summary>
        public string FieldValueName { get; set; }
        /// <summary>
        /// 显示标题
        /// </summary>
        public string FieldTitle { get; set; }
        /// <summary>
        /// 是否是拓展表
        /// </summary>
        public int ControlType { get; set; }
        /// <summary>
        /// 帮助提示信息
        /// </summary>
        public string FieldTip { get; set; }
        /// <summary>
        /// 控件placeholder提示信息
        /// </summary>
        public string FieldPlaceHolder { get; set; }
        /// <summary>
        /// 是否允许为空
        /// </summary>
        public Boolean IsAllowNull { get; set; }
        /// <summary>
        /// 不允许为空时，如果为空的提示信息
        /// </summary>
        public string NotAllowNullTip { get; set; }
        /// <summary>
        /// 值数据类型
        /// </summary>
        public int FieldValueType { get; set; }
        /// <summary>
        /// 字段值长度
        /// </summary>
        public int FieldValueLength { get; set; }
        /// <summary>
        /// 控件类型为单选、复选、下拉列表、组合框时，数据源数据库链接实例名称
        /// </summary>
        public string ListDbIns { get; set; }
        /// <summary>
        /// 控件类型为单选、复选、下拉列表、组合框时，数据源SQL语句，必须返回两个以上字段，第一个为 Text,第二个为Value
        /// </summary>
        public string ListSql { get; set; }
        /// <summary>
        /// 如果是下拉列表或组合框，联动时，要根据哪个字段的值过滤，这里配置字段名(仅支持主表中使用)
        /// </summary>
        public string ListRelateTargetField { get; set; }
        /// <summary>
        /// 时间选择格式字符串
        /// </summary>
        public string TimeFormat { get; set; }
        /// <summary>
        /// 组织机构选择是否允许多选
        /// </summary>
        public Boolean OrganIsCanMultiSel { get; set; }
        /// <summary>
        /// 可上传附件类型，格式如【.pdf,.doc】，为空表示全部类型
        /// </summary>
        public string FileAllowType { get; set; }
        /// <summary>
        /// 可以上传文件的个数，0表示不限制
        /// </summary>
        public int FileAllowCount { get; set; }
        /// <summary>
        /// 字段状态 
        /// </summary>
        public int FieldStatus { get; set; }
        /// <summary>
        /// 控件标题列所占宽度百分比
        /// </summary>
        public int FieldTitleShowWidth { get; set; }
        /// <summary>
        /// 控件显示宽度，默认值为98%,或直接输入像素
        /// </summary>
        public string ShowWidth { get; set; }
        /// <summary>
        /// 多行文本框行数
        /// </summary>
        public int MultiRows { get; set; }
        /// <summary>
        /// 显示高度，单位像素
        /// </summary>
        public int ShowHeight { get; set; }

        public string HtmlEx { get; set; }
        /// <summary>
        /// 控件后面添加的扩展按钮图标(双击选择):
        /// </summary>
        public string ExButtonIcon { get; set; }
        /// <summary>
        /// 控件后面添加的扩展按钮图标Tip:
        /// </summary>
        public string ExButtonTip { get; set; }
        /// <summary>
        /// 控件后面添加的扩展按钮图标，点击执行的扩展方法，支持表达式:
        /// </summary>
        public string ExButtonClickMethod { get; set; }
        /// <summary>
        /// 扩展事件1:
        /// </summary>
        public string EventName1 { get; set; }
        /// <summary>
        /// 事件执行的方法:
        /// </summary>
        public string EventMethod1 { get; set; }
        /// <summary>
        /// 扩展事件2:
        /// </summary>
        public string EventName2 { get; set; }
        /// <summary>
        ///  事件执行的方法:
        /// </summary>
        public string EventMethod2 { get; set; }


    }
    /// <summary>
    /// 排版视图配置
    /// </summary>
    public class Form_View : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int ViewId { get; set; }
        /// <summary>
        /// 排版视图配置编码
        /// </summary>
        public string ViewCode { get; set; }
        public int AutoIndex { get; set; }
        /// <summary>
        /// 视图名称
        /// </summary>
        public string ViewName { get; set; }
        /// <summary>
        /// 表单主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 视图类型
        /// </summary>
        public int ViewType { get; set; }
        public int ViewDeviceType { get; set; }
        /// <summary>
        /// 视图块名称
        /// </summary>
        public string ViewBlockTitle { get; set; }
        /// <summary>
        /// 编辑器排版视图---html内容
        /// </summary>
        public string FormViewHTML { get; set; }
        /// <summary>
        /// 是否是默认视图
        /// </summary>
        public Boolean IsDefault { get; set; }
    }
    /// <summary>
    /// 排版视图配置详情
    /// </summary>
    public class Form_View_Inner : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 表单主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 视图主键
        /// </summary>
        public int ViewId { get; set; }
        /// <summary>
        /// 字段编码
        /// </summary>
        public int FieldId { get; set; }
        /// <summary>
        /// 展示排序
        /// </summary>
        public int ShowOrder { get; set; }
        public int ViewBlockIndex { get; set; }
        /// <summary>
        /// 是否通栏展示
        /// </summary>
        public Boolean IsSpanAll { get; set; }
    }
    /// <summary>
    /// 使用场景配置
    /// </summary>
    public class Form_UseScene : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int SceneID { get; set; }
        /// <summary>
        /// 应用场景编码
        /// </summary>
        public string SceneCode { get; set; }
        public int AutoIndex { get; set; }
        /// <summary>
        /// 应用场景名称
        /// </summary>
        public string SceneName { get; set; }
        /// <summary>
        /// 表单主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 表单加载扩展事件类，多个用;分隔:
        /// </summary>
        public string FormLoadHandler { get; set; }
        /// <summary>
        /// 表单加载完成后，扩展JS方法:
        /// </summary>
        public string FormLoadExJSMethod { get; set; }
        /// <summary>
        /// 表单保存前，客户端扩展方法:
        /// </summary>
        public string BeforeFormClientSave { get; set; }
        /// <summary>
        /// 表单保存后扩展事件类，多个用;分隔:
        /// </summary>
        public string FormSaveHandler { get; set; }
        /// <summary>
        /// 表单保存后扩展SQL，也支持表达式，先执行SQL，再执行扩展类
        /// </summary>
        public string FormSaveExeSql { get; set; }
        /// <summary>
        /// 表单扩展脚本:
        /// </summary>
        public string FormScript { get; set; }
        /// <summary>
        /// 表单保存完后执行的操作:
        /// </summary>
        public int FormSavedAction { get; set; }
        /// <summary>
        /// 表单保存完后，配置跳转页面或方法名:
        /// </summary>
        public string FormSavedInfo { get; set; }
    }
    /// <summary>
    /// 使用场景配置---表单功能
    /// </summary>
    public class Form_UseSceneFunc : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int FuncId { get; set; }
        /// <summary>
        /// 表单主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 场景编码
        /// </summary>
        public int SceneID { get; set; }
        /// <summary>
        /// 标题:
        /// </summary>
        public string FuncTitle { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string FuncIcon { get; set; }
        /// <summary>
        /// 显示顺序:
        /// </summary>
        public int FuncOrder { get; set; }
        /// <summary>
        /// 执行脚本
        /// </summary>
        public string FuncExeJS { get; set; }
        /// <summary>
        /// 按钮显示控制:
        /// </summary>
        public int FuncIsShowInView { get; set; }
        /// <summary>
        /// 是否受权限控制:
        /// </summary>
        public Boolean IsControlByRight { get; set; }
        /// <summary>
        /// 拥有此权限角色名，多个，分隔:
        /// </summary>
        public string RoleNames { get; set; }
        /// <summary>
        /// 拥有此权限角色编码，多个，分隔:
        /// </summary>
        public string RoleIds { get; set; }

    }
    /// <summary>
    /// 权限集配置【<GroupType>2</GroupType>】 和初始化集配置【<GroupType>1</GroupType>】
    /// </summary>
    public class Form_Group : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int GroupID { get; set; }
        /// <summary>
        /// 组编码
        /// </summary>
        public string GroupCode { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int AutoIndex { get; set; }
        /// <summary>
        /// 组名称
        /// </summary>
        public string GroupName { get; set; }
        /// <summary>
        /// 表单主键
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        ///组类别
        /// </summary>
        public int GroupType { get; set; }
    }
    /// <summary>
    /// 权限集配置详情
    /// </summary>
    public class Form_FieldRight : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int RightID { get; set; }
        /// <summary>
        /// Form_Group 表主键
        /// </summary>
        public int GroupID { get; set; }
        /// <summary>
        /// 字段ID
        /// </summary>
        public int FieldId { get; set; }
        /// <summary>
        /// 表单ID
        /// </summary>
        public int FormId { get; set; }
        public int AccessType { get; set; }
        public int AccessScoreType { get; set; }
        public string RoleNames { get; set; }
        public string RoleIds { get; set; }
        public string DepNames { get; set; }
        public string DepIds { get; set; }
        public string UserNames { get; set; }
        public string UserIds { get; set; }
    }
    /// <summary>
    /// 初始化集配置详情
    /// </summary>
    public class Form_FieldInitValue : BaseEntity
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int InitId { get; set; }
        /// <summary>
        /// Form_Group 表主键
        /// </summary>
        public int GroupID { get; set; }
        /// <summary>
        /// 字段ID
        /// </summary>
        public int FieldId { get; set; }
        /// <summary>
        /// 表单ID
        /// </summary>
        public int FormId { get; set; }
        /// <summary>
        /// 初始化条件类型
        /// </summary>
        public int InitTimeType { get; set; }
        public string InitTimeDetail { get; set; }
        /// <summary>
        /// 初始化类型
        /// </summary>
        public int InitType { get; set; }
        /// <summary>
        /// 初始化内容 
        /// </summary>
        public string InitInfo { get; set; }
        /// <summary>
        /// 数据库连接实例
        /// </summary>
        public string InitSqlDbIns { get; set; }
    }

}